import {
  getMenuByRouter,
  getHomeRoute,
  localSave,
  localRead
} from '@/libs/util'
// import router from '@/router'
import routers from '@/router/routers'
import config from '@/config'
const { homeName } = config

export default {
  state: {
    homeRoute: {},
    local: localRead('local'),
    screenHeight:0
  },
  getters: {
    menuList: (state, getters, rootState) => getMenuByRouter(routers, rootState.user.access),
    errorCount: state => state.errorList.length,
    getScreenHeight: state => state.screenHeight
  },
  mutations: {
    setHomeRoute (state, routes) {
      state.homeRoute = getHomeRoute(routes, homeName)
    },
    setLocal (state, lang) {
      localSave('local', lang)
      state.local = lang
    },
    setScreenHeight(state,height){
      state.screenHeight = height
    }
  },
  actions: {

  }
}
